let express = require("express");
let app = express();
app.get("/todos", function (req, res) {
  // 返回了json数据
  res.json({ code: 1, msg: "获取todos列表" });
});
app.post("/todos", function (req, res) {
  // 返回了json数据
  res.json({ code: 1, msg: "发布todo" });
});
app.delete("/todos", function (req, res) {
  // 返回了json数据
  res.json({ code: 1, msg: "删除todo" });
});

app.patch("/todos", function (req, res) {
  // 返回了json数据
  res.json({ code: 1, msg: "修改todo" });
});

let productAPI = "/product";
app.get(productAPI, function (req, res) {
  // 返回了json数据
  res.json({ code: 1, msg: "获取列表" });
});
app.post(productAPI, function (req, res) {
  // 返回了json数据
  res.json({ code: 1, msg: "发布" });
});
app.delete(productAPI, function (req, res) {
  // 返回了json数据
  res.json({ code: 1, msg: "删除" });
});

app.patch(productAPI, function (req, res) {
  // 返回了json数据
  res.json({ code: 1, msg: "修改" });
});

app.listen(3000, function () {
  console.log("http://localhost:3000");
  console.log("http://127.0.0.1:3000");
});
